#include "user_key_tasks.h"

#include "lcd.h"

void key_task(void* pvParameters)
{
	uint8_t keystr=0;
	uint8_t Stopstr=0;
	uint8_t IdleBreakstr=0;
	
	while(1)
	{
		switch(key_scan(0))
		{
			case 1:
				keystr = 1;
				//LCD_ShowIntNum(50,50,keystr,4,RED,YELLOW,24);		//test
				xQueueSendToBack(Key_MessageQueue, &keystr, 1);
				xQueueSendToBack(IdleBreak_MessageQueue, &IdleBreakstr, 1);
				break;
			
			case 2:
				if(Page_Get_NowPage()->page_obj == &ui_HomePage)
				{
					xQueueSendToBack(Stop_MessageQueue, &Stopstr, 1);
				}else
				{
					keystr = 2;
					//LCD_ShowIntNum(50,50,keystr,4,RED,YELLOW,24);		//test
					xQueueSendToBack(Key_MessageQueue, &keystr, 1);
					xQueueSendToBack(IdleBreak_MessageQueue, &IdleBreakstr, 1);
				}
				break;
				
			default: 
				//LCD_ShowIntNum(50,50,0,4,RED,YELLOW,24);		//test
				break;
			
		}
		
		vTaskDelay(1);
	}
}

